import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    component: () => import("../views/Home.vue"),
    children: [
      {
        path: "/home",
        redirect: "/home/index",
      },
      {
        path: "/home/index",
        component: () => import("../views/Index.vue"),
        // redirect: "/home/index",
      },
      {
        path: "/home/cart",
        component: () => import("../views/Cart.vue"),
      },
      {
        path: "/home/classify",
        component: () => import("../views/Classify.vue"),
      },
      {
        path: "/home/mine",
        component: () => import("../views/Mine.vue"),
      },
    ],
  },
  {
    path: "/detail/:id",
    component: () => import("../views/Detail.vue"),
    props: true,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
